import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { GiftVO, GiftForm, GiftQuery } from '@/api/system/gift/types';

/**
 * 查询礼包列表
 * @param query
 * @returns {*}
 */

export const listGift = (query?: GiftQuery): AxiosPromise<GiftVO[]> => {
  return request({
    url: '/system/gift/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询礼包详细
 * @param id
 */
export const getGift = (id: string | number): AxiosPromise<GiftVO> => {
  return request({
    url: '/system/gift/' + id,
    method: 'get'
  });
};

/**
 * 新增礼包
 * @param data
 */
export const addGift = (data: GiftForm) => {
  return request({
    url: '/system/gift',
    method: 'post',
    data: data
  });
};

/**
 * 修改礼包
 * @param data
 */
export const updateGift = (data: GiftForm) => {
  return request({
    url: '/system/gift',
    method: 'put',
    data: data
  });
};

/**
 * 删除礼包
 * @param id
 */
export const delGift = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/gift/' + id,
    method: 'delete'
  });
};
